package tr.edu.metu.is550.isell.rest.message;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;

@XmlRootElement(name = "errors")
public class ErrorMessages {
    @XmlElement(name = "error")
    private List<ErrorMessage> errorMessages;

    public ErrorMessages() {
        this.errorMessages = new ArrayList<ErrorMessage>();
    }

    public ErrorMessages add(ErrorMessage errorMessage) {
        errorMessages.add(errorMessage);
        return this;
    }

    public ErrorMessages add(String errorCode, String desc, String... args) {
        return this.add(new ErrorMessage(errorCode, desc, args));
    }

    public ErrorMessages add(String errorCode, String desc) {
        return this.add(new ErrorMessage(errorCode, desc));
    }
}
